{% load agile_tags %}
{% if revisions %}
<h4>Revisions</h4>
<hr/>
{% for rev in revisions %}
	<div class='revision' id='rev_{{ rev.pk }}'>
		<strong>{{ rev.repo }} -  r{{ rev.number }}</strong> - <span style="font-size:small;">{{ rev.timestamp }}</span> 
		{% if is_task %}<button id='add_rev_{{ rev.pk }}' type="button" {% if not editable %} disabled="True" {% endif %}>Add</button>{% endif %}
		<pre class="revision-message">{{ rev.message}}</pre>
		<span style="font-size:small;"><strong>{{ rev.author}}</strong></span>
		<p/>
		{% if rev.tasks.all|empty_exclude:tid %}
		<div>
			Related Tasks:
			<table class='data-table'><tbody>
			<tr> <th>Name</th> <th>Project</th> <th>Sprint</th> <th>Type</th> <th>Status</th> <th>Priority</th> <th>View</th> <th>Edit</th> </tr>
			{% for task in rev.tasks.all %}
				{% if tid != task.pk %}
					<tr class={% cycle '' 'alt' %}>
						<td> {{ task.name }} </td>
						<td> <a href='/project/view/{{ task.project.pk }}/'> {{ task.project }} </a> </td>
						<td> {% if task.sprint == None %} - {% else %} <a href='/sprint/view/{{ task.sprint.pk }}'> {{ task.sprint }} </a> {% endif %} </td>
						<td> {{ task.type }} </td> 
						<td> {{ task.status }} </td> 
						<td> {{ task.priority }} </td>
						<td> <a href='/task/view/{{task.pk}}/'>View</a> </td>
						<td> <a href='/task/edit/{{task.pk}}/'>Edit</a> </td>
					</tr>
				{% endif %}
			{% endfor %}
			</tbody></table>
		</div>
		{% endif %}
	</div>
	<hr/>
{% endfor %}
{% endif %}